home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MOUSE.SWG / 0028_Another good mouse unit.pas < prev   
Pascal/Delphi Source File  |  1995-02-28  |  2KB  |  137 lines

  1. {This is some really GOOD stuff,  Bravo Bas! }
  2. Unit mouser;
  3. { Mouseunit for textmode. by Bas van Gaalen, Holland. }
  4. {      Slight Additions/Removals by CJ Cliffe         }
  5.  
  6. Interface
  7.  
  8. Const
  9.   mtypes : Array [0..4] Of String [6] = ('bus', 'serial', 'inport', 'ps/2', 'hp');
  10.   
  11. Var
  12.   buttons : Word;
  13.   verhi, verlo, mousetype : Byte;
  14.   driverinstalled : Boolean;
  15.   
  16. Function mouseinstalled : Boolean;
  17. Procedure resetmouse;
  18. Procedure getmouseversion;
  19. Procedure showmouse;
  20. Procedure hidemouse;
  21. Function getmousex : Byte;
  22. Function getmousey : Byte;
  23. Function leftpressed : Boolean;
  24. Function rightpressed : Boolean;
  25. Procedure mousewindow (X1, Y1, X2, Y2 : Byte);
  26.  
  27.  
  28. Implementation
  29.  
  30.  
  31. Function mouseinstalled : Boolean; Assembler; Asm
  32.   XOr AX, AX
  33.   Int 33h
  34.   cmp AX, - 1
  35.   je @skip
  36.   XOr AL, AL
  37.   @skip:
  38. End;
  39.  
  40. Procedure resetmouse; Assembler;
  41. Asm
  42.   XOr AX, AX
  43.   Int 33h
  44.   cmp AX, - 1
  45.   jne @skip
  46.   mov driverinstalled, True
  47.   mov buttons, BX
  48.   @skip:
  49. End;
  50.  
  51. Procedure getmouseversion; Assembler;
  52. Asm
  53.   mov AX, 24h
  54.   Int 33h
  55.   mov verhi, BH
  56.   mov verlo, BL
  57.   mov mousetype, CH
  58. End;
  59.  
  60. Procedure showmouse; Assembler;
  61. Asm
  62.   mov AX, 1
  63.   Int 33h
  64. End;
  65.  
  66. Procedure hidemouse; Assembler;
  67. Asm
  68.   mov AX, 2
  69.   Int 33h
  70. End;
  71.  
  72. Function getmousex : Byte; Assembler;
  73. Asm
  74.   mov AX, 3
  75.   Int 33h
  76.   ShR CX, 1
  77.   ShR CX, 1
  78.   ShR CX, 1
  79.   mov AX, CX
  80. End;
  81.  
  82. Function getmousey : Byte; Assembler;
  83. Asm
  84.   mov AX, 3
  85.   Int 33h
  86.   ShR DX, 1
  87.   ShR DX, 1
  88.   ShR DX, 1
  89.   mov AX, DX
  90. End;
  91.  
  92. Function leftpressed : Boolean; Assembler;
  93. Asm
  94.   mov AX, 3
  95.   Int 33h
  96.   And BX, 1
  97.   mov AX, BX
  98. End;
  99.  
  100. Function rightpressed : Boolean; Assembler;
  101. Asm
  102.   mov AX, 3
  103.   Int 33h
  104.   And BX, 2
  105.   mov AX, BX
  106. End;
  107.  
  108. Procedure mousewindow (X1, Y1, X2, Y2 : Byte); Assembler;
  109. Asm
  110.   mov AX, 7
  111.   XOr CH, CH
  112.   XOr DH, DH
  113.   mov CL, X1
  114.   ShL CX, 1
  115.   ShL CX, 1
  116.   ShL CX, 1
  117.   mov DL, X2
  118.   ShL DX, 1
  119.   ShL DX, 1
  120.   ShL DX, 1
  121.   Int 33h
  122.   mov AX, 8
  123.   XOr CH, CH
  124.   XOr DH, DH
  125.   mov CL, Y1
  126.   ShL CX, 1
  127.   ShL CX, 1
  128.   ShL CX, 1
  129.   mov DL, Y2
  130.   ShL DX, 1
  131.   ShL DX, 1
  132.   ShL DX, 1
  133.   Int 33h
  134. End;
  135.  
  136. End.
  137.